class RutasController < ApplicationController
  # GET /rutas
  # GET /rutas.xml
  def index
    @rutas = Ruta.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @rutas }
    end
  end

  # GET /rutas/1
  # GET /rutas/1.xml
  def show
    @ruta = Ruta.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @ruta }
    end
  end

  # GET /rutas/new
  # GET /rutas/new.xml
  def new
    @ruta = Ruta.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @ruta }
    end
  end

  # GET /rutas/1/edit
  def edit
    @ruta = Ruta.find(params[:id])
  end

  # POST /rutas
  # POST /rutas.xml
  def create
    @ruta = Ruta.new(params[:ruta])

    respond_to do |format|
      if @ruta.save
        format.html { redirect_to(@ruta, :notice => 'Ruta was successfully created.') }
        format.xml  { render :xml => @ruta, :status => :created, :location => @ruta }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @ruta.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /rutas/1
  # PUT /rutas/1.xml
  def update
    @ruta = Ruta.find(params[:id])

    respond_to do |format|
      if @ruta.update_attributes(params[:ruta])
        format.html { redirect_to(@ruta, :notice => 'Ruta was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @ruta.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /rutas/1
  # DELETE /rutas/1.xml
  def destroy
    @ruta = Ruta.find(params[:id])
    @ruta.destroy

    respond_to do |format|
      format.html { redirect_to(rutas_url) }
      format.xml  { head :ok }
    end
  end
end
